import React from "react";
// 这页面包含所有路由入口
import { HashRouter, Route, Switch } from "react-router-dom";
import App from "@/App"; //包裹所有路由的 空路由
import Login from "@/pages/login"; //登录页
import Home from '@/pages/home' //主页Home
import Admin from "@/admin"; //所有页面框架的主页面
import Buttons from "@/pages/ui/buttons"//按钮页
import Modals from "@/pages/ui/modals"//模态框页
import Loading from "@/pages/ui/loadings" //Loading
import Notice from "@/pages/ui/notice" //通知提醒
import Message from "@/pages/ui/messages" //全局提示框
import Tab from "@/pages/ui/tabs" //Tab标签页
import Gallery from "@/pages/ui/gallery" //图片墙
import Carousels from "@/pages/ui/carousel" //轮播图
import Logins from "@/pages/form/login" //登录
import Registers from "@/pages/form/register" //注册
import BasicTable from "@/pages/table/basicTable" //基础表格
import HighTable from "@/pages/table/highTable" //高级表格
import City from "@/pages/city" //城市列表
import Order from "@/pages/order" //订单管理  
import OrderDetail from "@/pages/order/detail" //订单详情  
import User from "@/pages/user" //用户管理  
import Bar from "@/pages/echarts" //图表
import Common from "@/common"
import Nofound from "@/pages/404"


export default class IRouter extends React.Component {
  render() {
    return (
      <HashRouter>
        <App>
          <Route path="/login" component={Login} />
          <Route path="/admin" render={() =>
            <Admin>
              <Switch>
                <Route path="/admin/home" component={Home} />
                <Route path="/admin/ui/buttons" component={Buttons} />
                <Route path="/admin/ui/modals" component={Modals} />
                <Route path="/admin/ui/loadings" component={Loading} />
                <Route path="/admin/ui/notice" component={Notice} />
                <Route path="/admin/ui/messages" component={Message} />
                <Route path="/admin/ui/tabs" component={Tab} />
                <Route path="/admin/ui/gallery" component={Gallery} />
                <Route path="/admin/ui/carousel" component={Carousels} />
                <Route path="/admin/form/login" component={Logins} />
                <Route path="/admin/form/register" component={Registers} />
                <Route path="/admin/table/basic" component={BasicTable} />
                <Route path="/admin/table/high" component={HighTable} />
                <Route path="/admin/city" component={City} />
                <Route path="/admin/order" component={Order} />
                <Route path="/admin/user" component={User} />
                <Route path="/admin/charts/bar" component={Bar} />
                <Route component={Nofound} />
              </Switch>
            </Admin>
          } />
          <Route path="/common" render={() =>{
              return <Common>
                <Route path="/common/order/detail/:orderId" component={OrderDetail}></Route>
              </Common>
          }}></Route>
        </App>
      </HashRouter>
    );
  }
}
